{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 339,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *\n",
    "from IPython.display import display, Math\n",
    "from math_use import *\n",
    "from handcalcs.decorator import handcalc\n",
    "# import math as m\n",
    "import handcalcs.render\n",
    "x,y,z,a,b,v1,v2,m,t,v0,m1,m2,V1,V2=symbols('x,y,z,a,b,v1,v2,m,t,v0,m1,m2,V1,V2')\n",
    "#参数传入 函数，积分变量和范围\n",
    "#x1=solve([f,g], [x, y, z])\n",
    "#integrate(f, (x, 0, 1),(y,x,x**(1/3)))\n",
    "#simplify(g)\n",
    "def out(x):\n",
    "    display(Math(latex(x)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 352,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 66.4218226548323$"
      ],
      "text/plain": [
       "<IPython.core.display.Math object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "f1=m1*v1-(m1*V1+m2*V2)\n",
    "f2=1/2*m1*v1**2-(1/2*m1*V1**2+1/2*m2*V2**2)\n",
    "x1=(acos(0.4)/3.1415926)*180\n",
    "out(x1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 341,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\[\n",
       "\\begin{aligned}\n",
       "a &= 2 \\cdot \\frac{ x }{ y }  = 2 \\cdot \\frac{ 1 }{ 1 } &= 2.0  \n",
       "\\\\[10pt]\n",
       "b &= 3 \\cdot a  = 3 \\cdot 2.0 &= 6.0  \n",
       "\\\\[10pt]\n",
       "c &= \\frac{ a + b }{ z }  = \\frac{ 2.0 + 6.0 }{ 1 } &= 8.0  \n",
       "\\end{aligned}\n",
       "\\]"
      ],
      "text/plain": [
       "<IPython.core.display.Latex object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/plain": [
       "{'x': 1, 'y': 1, 'z': 1, 'a': 2.0, 'b': 6.0, 'c': 8.0}"
      ]
     },
     "execution_count": 341,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@handcalc(left=\"\",right=\"\",jupyter_display=True)\n",
    "def my_calc(x, y, z):\n",
    "  a = 2*x / y\n",
    "  b = 3*a\n",
    "  c = (a + b) / z\n",
    "  return locals()\n",
    "my_calc(1,1,1)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "05a237592cd1f1c47d6da52b1c9e9cb4b6d7e67883224033955e685c2762c5fd"
  },
  "kernelspec": {
   "display_name": "Python 3.9.10 64-bit (windows store)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
